#include "StyleBuilder.hpp"
#include <cassert>

typedef enum { PIXPIECE = 0x30, PIXCELL = 0x31, PIXBACKGROUND = 0x32 } TPixmapType;
typedef enum { P_PAWN = 0x40, P_ROOK = 0x41, P_BISHOP = 0x42, P_KNIGHT = 0x43, P_QUEEN = 0x44, P_KING = 0x45 } TPieceType;
typedef enum { C_WHITE = 0x70, C_BLACK = 0x71 } TColorType;
typedef enum { PH_STANDARD = 0x80, PH_SELECTED = 0x81, PH_CHOICE = 0x82 } TPieceHighlightType;
typedef enum { CH_STANDARD = 0x90, CH_CHOICE = 0x91 } TCellHighlightType;


StyleBuilder::StyleBuilder()
	: Style()
{}

StyleBuilder::~StyleBuilder()
{}

void StyleBuilder::setPiecePixmap(Chess::Color color, Piece::Type ptype, Style::PieceHighlight highlight, QPixmap* pixmap)
{
	assert(pixmap != 0);
	pixpieces[color][ptype][highlight] = pixmap;
}

void StyleBuilder::setCellPixmap(Chess::Color color, Style::CellHighlight highlight, QPixmap* pixmap)
{
	assert (pixmap != 0);
	pixcells[color][highlight] = pixmap;
}

void StyleBuilder::setBackgroundPixmap(QPixmap* pixmap)
{
	assert (pixmap != 0);
	pixbg = pixmap;
}
		
/*
 * TABLE FORMAT
 * [PIXMAP_TYPE] OFFSET SIZE FILENAME
 * ...
 * TERMINATION BINARY WORD ??
 * 
 * SPECIFICATION
 * **************************************************
 * PIECE PAWN WHITE P_STANDARD OFFSET SIZE FILENAME
 * PIECE PAWN WHITE P_SELECTED OFFSET SIZE FILENAME
 * PIECE PAWN WHITE P_CHOICE OFFSET SIZE FILENAME
 * PIECE PAWN BLACK P_STANDARD OFFSET SIZE FILENAME
 * ...
 * PIECE ROOK WHITE P_STANDARD
 * ...
 * CELL WHITE P_STANDARD
 * CELL WHITE P_CHOICE
 * ...
 * BACKGROUND OFFSET SIZE FILENAME
 * ...
 */
void StyleBuilder::saveStyleFile(string filename)
{
	try
	{}
	catch(Exception* e)
	{	throw e;	}
}

void StyleBuilder::loadStyleFile(string filename)
{
	try
	{}
	catch(Exception* e)
	{	throw	e;	}
}
